<template>
  <div>
    <button type="button" @click="testGet">GET</button>
    <button type="button" @click="testPost">POST</button>
    <button type="button" @click="testDelete">DELETE</button>
  </div>
</template>

<script>

export default {
  name: 'AxiosView',
  data () {
    return {
      userForm: {
        username: 'lanzhoulamian',
        nickname: '兰州拉面',
        status: 1,
        avatar: 'qingzhen.png'
      }
    }
  },
  methods: {
    testGet () {
      this.$http.get('user/page', { page: 1, limit: 5 }).then(data => {
        console.log(data)
      })
    },
    testPost () {
      this.$http.post('user/add', this.userForm, true).then(data => {
        console.log(data)
      })
    },
    testDelete () {
      this.$http.delete('user/delete/18').then(data => {
        console.log(data)
      })
    }
  }
}
</script>

<style scoped>

</style>
